(define-module (fiio meghanada)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix build-system trivial)
  #:use-module (guix packages)
  #:use-module (guix download))

(define-public meghanada-server
  (package
    (name "meghanada-server")
    (version "1.2.0")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://github.com/mopemope/meghanada-server/releases/download/"
                    "v" version "/meghanada-1.2.0.jar"))
              (sha256
               (base32
                "1sag12m0s9ga3mhqndvhqy5jmvfzdd6pxn8d0rjd140k502bx786"))))
    (build-system trivial-build-system)
    (arguments
     `(#:modules ((guix build utils))
       #:builder (begin
                   (use-modules (guix build utils))
                   (let ((source (assoc-ref %build-inputs "source"))
                         (jar-dir (string-append %output "/share/")))
                     (mkdir-p jar-dir)
                     (copy-file source
                                (string-append jar-dir
                                               ,(string-append "meghanada-" version ".jar")))))))
    (home-page "https://github.com/mopemope/meghanada-server")
    (synopsis "Java IDE")
    (description "Meghanada adds Java IDE-like features to your
favourite editor.")
    (license license:gpl3+)))
